#!/bin/sh

volume_home='volume'
vol_dir="$volume_home/$1"

port=14088

echo "srarting for $vol_dir"
if [ ! -d "./$vol_dir" ]; then
    echo "directory $vol_dir not exist, creating directory $vol_dir"
    mkdir $vol_dir
else
    echo exist
fi

if [ $2 ]; then
    echo "port is $2"
    port=$2
else
    echo "use default port 14088"
fi

nvidia-docker run -itd --rm \
    -p $port:8888 \
    -v $(pwd)/$vol_dir:/workspace \
    -v /home/dailing/workspace/pyDeepDR/app/static/diag_result:/data:ro \
    -v $HOME/data:/data_1:ro \
    devenv \
    /run.sh
